<template>
  <div>
    <p v-if="showSon">子集显示</p>
    <button @click="handleBtn">点击控制显示隐藏</button>
  </div>
</template>
<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    showSon: {
      get () {
        return this.visible
      },
      set (val) {
        this.$emit('update:visible' ,val)
      }
    }
  },
  methods: {
    handleBtn () {
      this.showSon = !this.showSon;
    }
  }
}
</script>
